home *** CD-ROM | disk | FTP | other *** search
/ Painter Bear's Language Bridge — Italian / Bridge_ponte_itialian.iso / pc / helpers / open.dxr / 00006_tracking code.ls < prev    next >
Encoding:
Text File  |  2001-02-22  |  16.9 KB  |  563 lines

  1. on StampTrackingAtBegining
  2.   global gLangSelect, gLangDirect
  3.   if gLangDirect = 1 then
  4.     set title to "PAINTER BEAR'S LANGUAGE BRIDGE"
  5.   else
  6.     case gLangSelect of
  7.       "g":
  8.         set title to "Maler B√§rs Sprachenbr√ºcke"
  9.       "s":
  10.         set title to "PUENTE DE IDIOMAS DEL OSO PINTOR"
  11.       "f":
  12.         set title to "LE PONT DE LANGUES D'OURS-LE-PEINTRE"
  13.       "i":
  14.         set title to "PONTE DI LINGUAGGIO DEL PITTORE ORSO"
  15.     end case
  16.   end if
  17.   put EMPTY into field "trackingfield"
  18.   put "*************************************************" into field "trackingfield"
  19.   put RETURN & "* " & title & " *" after field "trackingfield"
  20.   put RETURN & "*************************************************" after field "trackingfield"
  21. end
  22.  
  23. on InitializeTracking whichGame
  24.   global gGameName, gTimeBegan, gTotalAttempts, gNumCorrect, gNumWrong, gWhichGame, gLevel, gLangSelect, gLangDirect
  25.   if gLangDirect = 1 then
  26.     set catTitle to "Category"
  27.     set dateTitle to "date"
  28.   else
  29.     case gLangSelect of
  30.       "g":
  31.         set catTitle to "Kategorie"
  32.         set dateTitle to "Datum"
  33.       "s":
  34.         set catTitle to "Categor√≠a"
  35.         set dateTitle to "Fecha"
  36.       "f":
  37.         set catTitle to "Cat√©gorie"
  38.         set dateTitle to "Date"
  39.       "i":
  40.         set catTitle to "Categoria"
  41.         set dateTitle to "Data"
  42.     end case
  43.   end if
  44.   set gWhichGame to whichGame
  45.   CallGamesByName()
  46.   set gTotalAttempts to 0
  47.   set gNumCorrect to 0
  48.   set gNumWrong to 0
  49.   set gTimeBegan to the short time
  50.   put EMPTY after field "trackingfield"
  51.   put RETURN & "================================================================" after field "trackingfield"
  52.   put RETURN & catTitle & ":" && gGameName after field "trackingfield"
  53.   put RETURN & dateTitle && the short date after field "trackingfield"
  54.   put RETURN & "----------------------------------------------------------------" after field "trackingfield"
  55. end
  56.  
  57. on CallGamesByName
  58.   global gWhichGame, gGameName, gLangSelect, gLangDirect
  59.   if gLangDirect = 1 then
  60.     case gWhichGame of
  61.       "colr":
  62.         set gGameName to "Colors"
  63.       "tran":
  64.         set gGameName to "Transportation"
  65.       "clth":
  66.         set gGameName to "Clothing"
  67.       "rltv":
  68.         set gGameName to "People"
  69.       "stor":
  70.         set gGameName to "Stores"
  71.       "buil":
  72.         set gGameName to "Buildings"
  73.       "body":
  74.         set gGameName to "The Body"
  75.       "spor":
  76.         set gGameName to "Sports and Hobbies"
  77.       "occp":
  78.         set gGameName to "Occupations"
  79.       "numb":
  80.         set gGameName to "Numbers"
  81.       "schl":
  82.         set gGameName to "School"
  83.       "dirc":
  84.         set gGameName to "Directions"
  85.       "bath":
  86.         set gGameName to "The Bathroom"
  87.       "kitc":
  88.         set gGameName to "The Kitchen"
  89.       "time":
  90.         set gGameName to "Time"
  91.       "geog":
  92.         set gGameName to "Geography"
  93.       "city":
  94.         set gGameName to "The City"
  95.       "hous":
  96.         set gGameName to "The House"
  97.       "furn":
  98.         set gGameName to "Furniture"
  99.       "weat":
  100.         set gGameName to "Weather"
  101.       "conj":
  102.         set gGameName to "Miscellaneous"
  103.       "anml":
  104.         set gGameName to "Animals"
  105.       "food":
  106.         set gGameName to "Food"
  107.       "advb":
  108.         set gGameName to "Adverbs"
  109.       "verb":
  110.         set gGameName to "Verbs"
  111.       "adjv":
  112.         set gGameName to "Adjectives"
  113.       "trvl":
  114.         set gGameName to "Travel"
  115.       "tphr":
  116.         set gGameName to "Travel Phrases"
  117.       "mphr":
  118.         set gGameName to "Other Helpful Phrases"
  119.       "all":
  120.         set gGameName to "Everything!"
  121.       "allw":
  122.         set gGameName to "All words"
  123.     end case
  124.   else
  125.     case gLangSelect of
  126.       "g":
  127.         case gWhichGame of
  128.           "colr":
  129.             set gGameName to "Farben"
  130.           "tran":
  131.             set gGameName to "Bef√∂rderungsmittel"
  132.           "clth":
  133.             set gGameName to "Bekleidung"
  134.           "rltv":
  135.             set gGameName to "Menschen"
  136.           "stor":
  137.             set gGameName to "Gesch√§fte"
  138.           "buil":
  139.             set gGameName to "Geb√§ude"
  140.           "body":
  141.             set gGameName to "Der K√∂rper"
  142.           "spor":
  143.             set gGameName to "Sport und Hobbys"
  144.           "occp":
  145.             set gGameName to "Berufe"
  146.           "numb":
  147.             set gGameName to "Nummern"
  148.           "schl":
  149.             set gGameName to "Schule"
  150.           "dirc":
  151.             set gGameName to "Richtungen"
  152.           "bath":
  153.             set gGameName to "Das Badezimmer"
  154.           "kitc":
  155.             set gGameName to "Die K√ºche"
  156.           "time":
  157.             set gGameName to "Uhrzeit"
  158.           "geog":
  159.             set gGameName to "Erdkunde"
  160.           "city":
  161.             set gGameName to "Die Stadt"
  162.           "hous":
  163.             set gGameName to "Das Haus"
  164.           "furn":
  165.             set gGameName to "M√∂bel"
  166.           "weat":
  167.             set gGameName to "Wetter"
  168.           "conj":
  169.             set gGameName to "Verschiedenes"
  170.           "anml":
  171.             set gGameName to "Tiere"
  172.           "food":
  173.             set gGameName to "Lebensmittel"
  174.           "advb":
  175.             set gGameName to "Adverben"
  176.           "verb":
  177.             set gGameName to "Verben"
  178.           "adjv":
  179.             set gGameName to "Adjektive"
  180.           "trvl":
  181.             set gGameName to "Reise"
  182.           "tphr":
  183.             set gGameName to "Reise-Redewendungen"
  184.           "mphr":
  185.             set gGameName to "Andere n√ºtzliche Redewendungen"
  186.           "all":
  187.             set gGameName to "Alles!"
  188.           "allw":
  189.             set gGameName to "Alle W√∂rter"
  190.         end case
  191.       "s":
  192.         case gWhichGame of
  193.           "colr":
  194.             set gGameName to "Colores"
  195.           "tran":
  196.             set gGameName to "Transporte"
  197.           "clth":
  198.             set gGameName to "Ropas"
  199.           "rltv":
  200.             set gGameName to "Gente"
  201.           "stor":
  202.             set gGameName to "Tiendas"
  203.           "buil":
  204.             set gGameName to "Edificios"
  205.           "body":
  206.             set gGameName to "El cuerpo"
  207.           "spor":
  208.             set gGameName to "Deportes y pasatiempos"
  209.           "occp":
  210.             set gGameName to "Ocupaciones"
  211.           "numb":
  212.             set gGameName to "N√∫meros"
  213.           "schl":
  214.             set gGameName to "Escuela"
  215.           "dirc":
  216.             set gGameName to "Direcciones"
  217.           "bath":
  218.             set gGameName to "El ba√±o"
  219.           "kitc":
  220.             set gGameName to "La cocina"
  221.           "time":
  222.             set gGameName to "Tiempo"
  223.           "geog":
  224.             set gGameName to "Geograf√≠a"
  225.           "city":
  226.             set gGameName to "La ciudad"
  227.           "hous":
  228.             set gGameName to "La casa"
  229.           "furn":
  230.             set gGameName to "Mobiliario"
  231.           "weat":
  232.             set gGameName to "El tiempo"
  233.           "conj":
  234.             set gGameName to "Miscel√°nea"
  235.           "anml":
  236.             set gGameName to "Animales"
  237.           "food":
  238.             set gGameName to "Comida"
  239.           "advb":
  240.             set gGameName to "Adverbios"
  241.           "verb":
  242.             set gGameName to "Verbos"
  243.           "adjv":
  244.             set gGameName to "Adjetivos"
  245.           "trvl":
  246.             set gGameName to "Viajar"
  247.           "tphr":
  248.             set gGameName to "Frases para viajar"
  249.           "mphr":
  250.             set gGameName to "Otras expresiones √∫tiles"
  251.           "all":
  252.             set gGameName to "¬°Todo!"
  253.           "allw":
  254.             set gGameName to "Todas las palabras"
  255.         end case
  256.       "f":
  257.         case gWhichGame of
  258.           "colr":
  259.             set gGameName to "Couleurs"
  260.           "tran":
  261.             set gGameName to "Moyens de transport"
  262.           "clth":
  263.             set gGameName to "V√™tements"
  264.           "rltv":
  265.             set gGameName to "Gens"
  266.           "stor":
  267.             set gGameName to "Magasins"
  268.           "buil":
  269.             set gGameName to "B√¢timents"
  270.           "body":
  271.             set gGameName to "Le corps"
  272.           "spor":
  273.             set gGameName to "Sports et passe-temps"
  274.           "occp":
  275.             set gGameName to "Professions"
  276.           "numb":
  277.             set gGameName to "Nombres"
  278.           "schl":
  279.             set gGameName to "L'√©cole"
  280.           "dirc":
  281.             set gGameName to "Directions"
  282.           "bath":
  283.             set gGameName to "La salle de bains"
  284.           "kitc":
  285.             set gGameName to "La cuisine"
  286.           "time":
  287.             set gGameName to "L'heure"
  288.           "geog":
  289.             set gGameName to "La g√©ographie"
  290.           "city":
  291.             set gGameName to "La ville"
  292.           "hous":
  293.             set gGameName to "La maison"
  294.           "furn":
  295.             set gGameName to "Les meubles"
  296.           "weat":
  297.             set gGameName to "Le temps"
  298.           "conj":
  299.             set gGameName to "Divers"
  300.           "anml":
  301.             set gGameName to "Les animaux"
  302.           "food":
  303.             set gGameName to "La nourriture"
  304.           "advb":
  305.             set gGameName to "Les adverbes"
  306.           "verb":
  307.             set gGameName to "Les verbes"
  308.           "adjv":
  309.             set gGameName to "Les adjectifs"
  310.           "trvl":
  311.             set gGameName to "Les Voyages"
  312.           "tphr":
  313.             set gGameName to "Expressions utiles pour voyager"
  314.           "mphr":
  315.             set gGameName to "Autres expressions utiles"
  316.           "all":
  317.             set gGameName to "Tout!"
  318.           "allw":
  319.             set gGameName to "Tous les mots"
  320.         end case
  321.       "i":
  322.         case gWhichGame of
  323.           "colr":
  324.             set gGameName to "Colori"
  325.           "tran":
  326.             set gGameName to "Trasportazione"
  327.           "clth":
  328.             set gGameName to "Abbigliamento"
  329.           "rltv":
  330.             set gGameName to "Persone"
  331.           "stor":
  332.             set gGameName to "Negozi"
  333.           "buil":
  334.             set gGameName to "Edifici"
  335.           "body":
  336.             set gGameName to "Il corpo"
  337.           "spor":
  338.             set gGameName to "Sport e Passatempi"
  339.           "occp":
  340.             set gGameName to "Occupazioni"
  341.           "numb":
  342.             set gGameName to "Numeri"
  343.           "schl":
  344.             set gGameName to "Scuola"
  345.           "dirc":
  346.             set gGameName to "Indicazioni"
  347.           "bath":
  348.             set gGameName to "La Stanza  da Bagno"
  349.           "kitc":
  350.             set gGameName to "La Cucina"
  351.           "time":
  352.             set gGameName to "Orario"
  353.           "geog":
  354.             set gGameName to "Geografia"
  355.           "city":
  356.             set gGameName to "La Citt√†"
  357.           "hous":
  358.             set gGameName to "La Casa"
  359.           "furn":
  360.             set gGameName to "Mobili"
  361.           "weat":
  362.             set gGameName to "Tempo"
  363.           "conj":
  364.             set gGameName to "Varie"
  365.           "anml":
  366.             set gGameName to "Animali"
  367.           "food":
  368.             set gGameName to "Cibi"
  369.           "advb":
  370.             set gGameName to "Avverbi"
  371.           "verb":
  372.             set gGameName to "Verbi"
  373.           "adjv":
  374.             set gGameName to "Aggettivi"
  375.           "trvl":
  376.             set gGameName to "Viaggiatore"
  377.           "tphr":
  378.             set gGameName to "Frasi per il viaggiatore"
  379.           "mphr":
  380.             set gGameName to "Altre Frasi Utili"
  381.           "all":
  382.             set gGameName to "Tutto!"
  383.           "allw":
  384.             set gGameName to "Tutte parole"
  385.         end case
  386.     end case
  387.   end if
  388. end
  389.  
  390. on TrackChangeGame
  391.   global gWhichGame, gTotalAttempts, gNumCorrect, gNumWrong, gTimeBegan, gLangSelect, gLangDirect
  392.   if gLangDirect = 1 then
  393.     set timeTitle to "Time began"
  394.     set timeEndTitle to "Time ended"
  395.     set attemptTitle to "Number of problems attempted"
  396.     set totCorr to "Total correct"
  397.     set totInCorr to "Total incorrect"
  398.     set perCorr to "Percent correct"
  399.   else
  400.     case gLangSelect of
  401.       "g":
  402.         set timeTitle to "Anfangszeit"
  403.         set timeEndTitle to "Schlu√üzeit"
  404.         set attemptTitle to "Anzahl versuchter Probleml√∂sungen"
  405.         set totCorr to "Gesamtzahl richtig"
  406.         set totInCorr to "Gesamtzahl falsch"
  407.         set perCorr to "Prozentzahl richtig"
  408.       "s":
  409.         set timeTitle to "La hora comez√≥"
  410.         set timeEndTitle to "La hora termin√≥"
  411.         set attemptTitle to "N√∫mero de problemas intentados"
  412.         set totCorr to "Total correcto"
  413.         set totInCorr to "Total incorrecto"
  414.         set perCorr to "Porcentaje correcto"
  415.       "f":
  416.         set timeTitle to "Heure du d√©but"
  417.         set timeEndTitle to "Heure de la fin"
  418.         set attemptTitle to "Nombre de probl√®mes tent√©s"
  419.         set totCorr to "Total des r√©ponses correctes"
  420.         set totInCorr to "Total des r√©ponses incorrectes"
  421.         set perCorr to "Pourcentage des r√©ponses correctes"
  422.       "i":
  423.         set timeTitle to "Orario d'inizio"
  424.         set timeEndTitle to "Orario di conclusione"
  425.         set attemptTitle to "Numero di problemi tentati"
  426.         set totCorr to "Totale corretto"
  427.         set totInCorr to "Totale sbagliato"
  428.         set perCorr to "Percentuale corretta"
  429.     end case
  430.   end if
  431.   if gTotalAttempts > 0 then
  432.     set the floatPrecision to 1
  433.     set X to integer(float(gNumCorrect) / float(gTotalAttempts) * 100.0)
  434.     put RETURN & "----------------------------------------------------------------" after field "trackingfield"
  435.     put RETURN & timeTitle & ":" && gTimeBegan after field "trackingfield"
  436.     put RETURN & timeEndTitle & ":" && the short time after field "trackingfield"
  437.     put RETURN & attemptTitle & ":" && gTotalAttempts after field "trackingfield"
  438.     put RETURN & totCorr & ":" && gNumCorrect after field "trackingfield"
  439.     put RETURN & totInCorr & ":" && gNumWrong after field "trackingfield"
  440.     put RETURN & perCorr & ":" && X & "%" after field "trackingfield"
  441.   end if
  442. end
  443.  
  444. on TrackAnswer wasItRight, rightAnswer, yourAnswer
  445.   global gTotalAttempts, gNumCorrect, gNumWrong, gLevel, gAnswer, gGameName, gQuestion, gLangSelect, gLangDirect
  446.   if gLangDirect = 1 then
  447.     set catTitle to "Category"
  448.   else
  449.     case gLangSelect of
  450.       "g":
  451.         set catTitle to "Kategorie"
  452.       "s":
  453.         set catTitle to "Categor√≠a"
  454.       "f":
  455.         set catTitle to "Cat√©gorie"
  456.       "i":
  457.         set catTitle to "Categoria"
  458.     end case
  459.   end if
  460.   set gTotalAttempts to gTotalAttempts + 1
  461.   case wasItRight of
  462.     "1":
  463.       put RETURN & catTitle & ": " & gGameName & "/" & gQuestion & "/" & rightAnswer after field "trackingfield"
  464.       set gNumCorrect to gNumCorrect + 1
  465.     "0":
  466.       put RETURN & catTitle & ": " & gGameName & "/" & gQuestion & "/" & rightAnswer & "/" & yourAnswer & " (*)" after field "trackingfield"
  467.       set gNumWrong to gNumWrong + 1
  468.   end case
  469. end
  470.  
  471. on FinishTracking
  472.   global gLangSelect, gLangDirect
  473.   if gLangDirect = 1 then
  474.     set wrongResp to "*indicates an incorrect response."
  475.   else
  476.     case gLangSelect of
  477.       "g":
  478.         set wrongResp to "*zeigt eine falsche Antwort an."
  479.       "s":
  480.         set wrongResp to "*indica una respuesta incorrecta."
  481.       "f":
  482.         set wrongResp to "*indique une r√©ponse incorrecte."
  483.       "i":
  484.         set wrongResp to "*Indica una risposta sbagliata."
  485.     end case
  486.   end if
  487.   put RETURN & "---------------------------------" after field "trackingfield"
  488.   put RETURN && wrongResp after field "trackingfield"
  489.   put RETURN & "---------------------------------" after field "trackingfield"
  490. end
  491.  
  492. on ClearTrackingFields
  493.   put EMPTY into field "trackingfield"
  494. end
  495.  
  496. on printTrackingField
  497.   global gMachineType
  498.   cursor(4)
  499.   set gMachineType to the machineType
  500.   if gMachineType = 256 then
  501.     set printingFont to "Courier"
  502.     set printingSize to 12
  503.     openXLib("pmatic.dll")
  504.   else
  505.     set printingFont to "Courier"
  506.     set printingSize to 12
  507.   end if
  508.   set printer to PrintOMatic(mnew)
  509.   if not objectp(printer) then
  510.     alert("There is no currently selected printer. Printing features are disabled.")
  511.   else
  512.     printer(mRegister, "PMAT130-209-01293")
  513.     printer(mSetMargins, 60, 60, 60, 60)
  514.     set w to printer(mGetPageWidth)
  515.     set h to printer(mGetPageHeight)
  516.     printer(mSetTextFont, printingFont)
  517.     printer(mSetTextSize, printingSize)
  518.     printer(mSetTextStyle, "normal")
  519.     printer(mNewPage)
  520.     printer(mTextBox, 0, 0, w, h, 0)
  521.     set textString to field "Trackingfield"
  522.     printer(mSetText, textString, 1)
  523.     printer(mPrint)
  524.     printer(mdispose)
  525.     if gMachineType = 256 then
  526.       closeXLib("pmatic.dll")
  527.     end if
  528.   end if
  529.   cursor(-1)
  530. end
  531.  
  532. on SaveTrackingField
  533.   cursor(4)
  534.   if the machineType = 256 then
  535.     set FileLineDelimiter to RETURN & numToChar(10)
  536.   else
  537.     set FileLineDelimiter to RETURN
  538.   end if
  539.   if objectp(myFile) then
  540.     set myFile to 0
  541.   end if
  542.   set theFile to the text of field "Trackingfield"
  543.   set myFile to new(xtra("FileIO"))
  544.   if the moviePath = EMPTY then
  545.     alert("An uncontrolable error occured while saving, please exit.")
  546.   else
  547.     set FilePath to displaySave(myFile, "Choose a place to save:", "BEAR.txt")
  548.     createFile(myFile, FilePath)
  549.     openFile(myFile, FilePath, 0)
  550.     delete(myFile)
  551.     createFile(myFile, FilePath)
  552.     openFile(myFile, FilePath, 0)
  553.     setPosition(myFile, 0)
  554.     setFinderInfo(myFile, "TEXT ttxt")
  555.     repeat with X = 1 to the number of lines in theFile
  556.       writeString(myFile, line X of theFile & FileLineDelimiter)
  557.     end repeat
  558.   end if
  559.   closeFile(myFile)
  560.   set myFile to 0
  561.   cursor(-1)
  562. end
  563.